#pragma once
#include "atltypes.h"

enum POINT_STATUS{
	RECT_POINT_LEFT,
	RECT_POINT_RIGHT,
	INTERSECTION
};

class CFIT_6204_Gorodilov_Line;

class CFIT_6204_Gorodilov_Point 
{
public:

	CFIT_6204_Gorodilov_Point()
	: x(0.0)
	, y(0.0)
	{
		
	}

	CFIT_6204_Gorodilov_Point(const CPoint &p)
	: x(p.x)
	, y(p.y)
	{
		
	}

	double x;
	double y;
	CFIT_6204_Gorodilov_Line *parent;
	CFIT_6204_Gorodilov_Line *parent2;
	POINT_STATUS status;
	CFIT_6204_Gorodilov_Point& operator =(const CPoint& b);
};

class CFIT_6204_Gorodilov_Line
{
public:
	CFIT_6204_Gorodilov_Line();
	CFIT_6204_Gorodilov_Line(const CFIT_6204_Gorodilov_Point p1, const CFIT_6204_Gorodilov_Point p2);
	~CFIT_6204_Gorodilov_Line(void);
private:
	CFIT_6204_Gorodilov_Point m_pLeft;
	CFIT_6204_Gorodilov_Point m_pRight;

public:
	const CFIT_6204_Gorodilov_Point GetLeftPoint(void) const;
	const CFIT_6204_Gorodilov_Point GetRightPoint(void) const;

	//const CPoint SetLeftPoint(CPoint point);
	int UpdatePoints(const CPoint p1, const CPoint p2);
	double GetCrossPoint(const double x);
};



int comparePoints(const void *, const void *) ;
BOOL crossLines(CFIT_6204_Gorodilov_Line *l1, CFIT_6204_Gorodilov_Line *l2, CFIT_6204_Gorodilov_Point &p);
